Skip to main content
GET
/
v1
/
promotion-codes
/
{id}
Get promotion code
curl --request GET \
  --url https://api.hyperline.co/v1/promotion-codes/{id} \
  --header 'Authorization: Bearer <token>'
import requests

url = "https://api.hyperline.co/v1/promotion-codes/{id}"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.text)
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

fetch('https://api.hyperline.co/v1/promotion-codes/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.hyperline.co/v1/promotion-codes/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"net/http"
"io"
)

func main() {

url := "https://api.hyperline.co/v1/promotion-codes/{id}"

req, _ := http.NewRequest("GET", url, nil)

req.Header.Add("Authorization", "Bearer <token>")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.get("https://api.hyperline.co/v1/promotion-codes/{id}")
.header("Authorization", "Bearer <token>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.hyperline.co/v1/promotion-codes/{id}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
{
  "id": "promo_DKL4Xcb5VSa8CQ",
  "code": "PROMO123",
  "coupon_id": "cou_DKL4Xcb5VSa8CQ",
  "client_id": "cli_DKL4Xcb5VSa8CQ",
  "customer_id": "cus_DKL4Xcb5VSa8CQ",
  "plan_id": "plan_DKL4Xcb5VSa8CQ",
  "product_id": "itm_DKL4Xcb5VSa8CQ",
  "created_at": "2021-01-01T00:00:00.000Z",
  "updated_at": "2021-01-01T00:00:00.000Z",
  "expires_at": "2021-01-01T00:00:00.000Z",
  "max_redemptions": 10,
  "current_redemptions": 0,
  "duration_count": 1,
  "duration_period": "months",
  "only_for_first_time_order": false
}
{
"message": "<string>"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

id
string
required

Response

id
string
required

Promotion code ID.

Example:

"promo_DKL4Xcb5VSa8CQ"

code
string
required

Promotion code.

Example:

"PROMO123"

coupon_id
string
required

Coupon ID.

Example:

"cou_DKL4Xcb5VSa8CQ"

client_id
string
required

Client ID.

Example:

"cli_DKL4Xcb5VSa8CQ"

customer_id
string | null
required

If a customer_id is set, this promotion code will only be available to this customer.

Example:

"cus_DKL4Xcb5VSa8CQ"

plan_id
string | null
required

If a plan_id is set, this promotion code will only be available for subscriptions with this plan ID.

Example:

"plan_DKL4Xcb5VSa8CQ"

product_id
string | null
required

If a product_id is set, this promotion code will only be available for subscriptions with this product ID.

Example:

"itm_DKL4Xcb5VSa8CQ"

created_at
string<date-time>
required

Promotion code creation date. UTC date time string in the ISO 8601 format.

Example:

"2021-01-01T00:00:00.000Z"

updated_at
string<date-time>
required

Promotion code last edition date. UTC date time string in the ISO 8601 format.

Example:

"2021-01-01T00:00:00.000Z"

expires_at
string<date-time> | null
required

Date and time when the promotion code expires.

Example:

"2021-01-01T00:00:00.000Z"

max_redemptions
number | null
required

Maximum number of redemptions for the promotion code. Independent from coupon's max redemptions.

Example:

10

current_redemptions
number | null
required

Current number of redemptions for the promotion code.

Example:

0

duration_count
number | null
required

Duration count applied to the subscription for the promotion code. 0 or null for once

Example:

1

duration_period
enum<string> | null
required

Duration period applied to the subscription for the promotion code for the promotion code. Valid values are once, days, weeks, months, years

Available options:
once,
days,
weeks,
months,
years
Example:

"months"

only_for_first_time_order
boolean | null
required

Whether the promotion code is only for first time orders. Defaults to false

Example:

false